/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Ventanas;
import Entidades.Usuario;
import Reportes.GeneradordeReportes;
/**
 *
 * @author Miguel
 */
public class frmPrincipal extends javax.swing.JFrame {
    
    private Usuario usuarioIniciado;//objeto que tendra los datos del usuario que haya accedido al sistema
    //private PnlTipoUsuario pnlTipoUsuario;//panel para el ingreso de los tipos de usuario
    private PnlUsuario pnlUsuario;
    private int panelActual;//0- PnlTipoUsuario
    /**
     * Creates new form frmPrincipal
     */
    public frmPrincipal() {
        initComponents();
    }
    
    public frmPrincipal(Usuario usuario) {
        usuarioIniciado=usuario;
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        pnlBotones = new javax.swing.JPanel();
        btnTipoUsuario = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();
        pnlContenedorPrincipal = new javax.swing.JPanel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setMinimumSize(new java.awt.Dimension(720, 550));

        pnlBotones.setBackground(new java.awt.Color(54, 149, 240));
        pnlBotones.setMaximumSize(new java.awt.Dimension(640, 50));
        pnlBotones.setMinimumSize(new java.awt.Dimension(640, 50));
        pnlBotones.setPreferredSize(new java.awt.Dimension(640, 50));

        btnTipoUsuario.setText("Tipo de usuario");
        btnTipoUsuario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnTipoUsuarioActionPerformed(evt);
            }
        });
        pnlBotones.add(btnTipoUsuario);

        jButton1.setText("Usuario");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        pnlBotones.add(jButton1);

        getContentPane().add(pnlBotones, java.awt.BorderLayout.PAGE_START);

        pnlContenedorPrincipal.setBackground(new java.awt.Color(255, 255, 255));
        pnlContenedorPrincipal.setLayout(new java.awt.CardLayout());
        getContentPane().add(pnlContenedorPrincipal, java.awt.BorderLayout.CENTER);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnTipoUsuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnTipoUsuarioActionPerformed
        removerElementosContenedorPrincipal();
        pnlIngresoTipoUsuario panelTipos =new pnlIngresoTipoUsuario();
        pnlContenedorPrincipal.add(panelTipos, "pnlTipoUsuario");
    }//GEN-LAST:event_btnTipoUsuarioActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        removerElementosContenedorPrincipal();
        PnlUsuario panelUsuario=new PnlUsuario();
        pnlContenedorPrincipal.add(panelUsuario, "pnlUsuario");
    }//GEN-LAST:event_jButton1ActionPerformed

    private void removerElementosContenedorPrincipal(){
        pnlContenedorPrincipal.removeAll();
    }
    
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(frmPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(frmPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(frmPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(frmPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        
        
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new frmPrincipal().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnTipoUsuario;
    private javax.swing.JButton jButton1;
    private javax.swing.JPanel pnlBotones;
    private javax.swing.JPanel pnlContenedorPrincipal;
    // End of variables declaration//GEN-END:variables
}
